<?php

/***

LZRoster: A roster for World of Warcraft.
Copyright (C) 2007  Emmanuel Cron

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

***/

require_once dirname(__FILE__)."/Localization.class.php";

/**
 * Represents a grace period, i.e. a period
 * during a character is valid. When this period
 * expires, the caracter should be automatically
 * deleted from the roster.
 * 
 * @author Emmanuel Cron
 *
 */
class GracePeriod {
	/** Id of the grace period. */
	private $id;
	
	/** The period during the character is valid.*/
	private $period;
	
	/** The raw (not localized) name of the grace period. */
	private $name;
	
	/**
	 * Creates a new grace period object.
	 * 
	 * @param $id the id of the grace period
	 * @param $period the period during which
	 * 		a character is valid, in milliseconds
	 * @param $name the name of the grace period
	 */
	function GracePeriod($id, $period, $name) {
		$this->id = $id;
		$this->period = $period;
		$this->name = $name;
	}
	
	/**
	 * Returns the id of this grace period.
	 * 
	 * @return the id of this grace period
	 */
	function GetId() {
		return $this->id;
	}
	
	/**
	 * Returns the period of this grace
	 * period.
	 * 
	 * @return the period in milliseconds
	 */
	function GetPeriod() {
		return $this->period;
	}
	
	/**
	 * Returns the localized name of this grace
	 * period, localization based on the current
	 * localization used by the roster.
	 * 
	 * @return the localized name of this grace
	 * 		period
	 */
	function GetLocalizedName() {
		return Localization::GetInstance()->Get($this->name);
	}
}

?>